Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DT-530: Add conditional rendering around apply for access #2718

Merged
merged 6 commits into from
Nov 12, 2024

Conversation

rushtong
Copy link
Contributor

@rushtong rushtong commented Nov 7, 2024

Addresses

https://broadworkbench.atlassian.net/browse/DT-530

Summary

Note to developers: I suggest hiding whitespace due to the large number of lint changes. I modified the datasets seen in the screenshots so they have URL values. Most dev datasets do not have them.

This PR makes the following modifications to the individual dataset page:

  1. Display the Dataset Identifier instead of the alias (this is a bug fix)
  2. If Controlled Access, no changes
  3. If Open Access, render specific text as seen in the ticket/mocks.
  4. If External Access, render specific text as seen in the ticket/mocks.
  5. New tests for this component and the 5 conditions around access.

In the Open/External cases, we only render a link (and relevant link language) if one exists as a URL property on the dataset.

Controlled Access (no changes)

Screenshot 2024-11-07 at 12 25 20 PM

Open Access

Screenshot 2024-11-07 at 12 24 29 PM

Screenshot 2024-11-07 at 12 26 49 PM

External Access

Screenshot 2024-11-07 at 12 22 45 PM

Screenshot 2024-11-07 at 12 24 16 PM


Have you read Terra's Contributing Guide lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@rushtong rushtong marked this pull request as ready for review November 7, 2024 17:32
@rushtong rushtong requested a review from a team as a code owner November 7, 2024 17:32
@rushtong rushtong requested review from pshapiro4broad and rjohanek and removed request for a team November 7, 2024 17:32
Copy link
Contributor

@rjohanek rjohanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes and new text looks good. would be nice to add tests for these new different cases.

@rushtong
Copy link
Contributor Author

rushtong commented Nov 7, 2024

would be nice to add tests for these new different cases.

Yes, I should do that!

Copy link
Member

@pshapiro4broad pshapiro4broad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a couple minor things

setIsLoading(false);
}
};

const accessButton = () => {
const accessManagement = extract('Access Management').toLowerCase();
if (accessManagement === 'controlled') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a switch work here? I think using switch would make it clearer that each if is comparing against the same thing, and that each if clause is terminal.

If you used a functional style switch (like lodash https://lodash.com/docs/4.17.15#cond), you could say return _.cond(...);.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this could be cleaner with a switch. I will look into cond - have not used that before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some unintended behavior with using cond (hrefs were being removed from anchor elements) so I stuck with a switch approach.

}
</span>;
}
return <div/>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see accessManagement is type string, do we expect other values here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just string values come through. On the consent side, we do have an enum so we can actually enforce this here as well.

setIsLoading(false);
}
};

const accessButton = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this name correct? It only returns a button in one case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rename it to make it more reflective of what it's doing now that it's not just a button any more.

@rushtong rushtong merged commit 2260bfc into develop Nov 12, 2024
9 checks passed
@rushtong rushtong deleted the gr-DT-530-conditional-apply-text branch November 12, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants